{include file="base/header"}
        <div class="layui-card">
            <div class="layui-card-body">
                <form class="layui-form" action="javasript:;" id="formId" >
                    <div class="layui-form-item">
                        <div class="layui-form-item layui-inline">
                            <label class="layui-form-label">联调链接</label>
                            <div class="layui-input-inline" style="width:230px;margin-right: 0px!important">
                                <input type="text" name="url" autocomplete="off" placeholder="" lay-verify="required" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item layui-inline" >
                            <label class="layui-form-label" >TOKEN</label>
                            <div class="layui-input-inline" style="width:230px;margin-right: 0px!important">
                                <input type="text" name="token" autocomplete="off" placeholder="" lay-verify="required" class="layui-input">
                            </div>
                        </div>
                      
                        <div class="layui-form-item layui-inline">
                            <button class="pear-btn pear-btn-md pear-btn-primary" type="submit" lay-submit=""
                    lay-filter="form-save">
                                <i class="layui-icon layui-icon-senior"></i>
                                执行联调
                            </button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
        
        <div class="layui-card">
            <div class="layui-card-body">
                <table id="tableId" lay-filter="user-table"></table>
            </div>
        </div>
 
        
 
        <script type="text/html" id="user-status">
          正常
        </script>
 
        <script>
			layui.use(['table', 'form', 'jquery','common'], function() {
				let table = layui.table;
				let form = layui.form;
				let $ = layui.jquery;
				let common = layui.common;
                let cols = [
                    [{
                        title: 'ID',
                        field: 'id',
                        align: 'center',
                        width: 50
                    },
         
                    {
                        title: '联调链接',
                        field: 'url',
                        align: 'left',
                        width: 500
                    },
                    {
                            title: 'token',
                            field: 'token',
                            align: 'left',
                             width: 400
                        },
           
                    {
                        title: '状态',
                        field: 'status',
                        align: 'center',
                        templet: '#user-status'
                    },
                    {
                        title: '联调时间',
                        field: 'addtime',
                        align: 'left'
                    }
                 
                    ]
                ];
                table.render({
                    elem: '#tableId',
                    url: "{:url('basic/bdyx')}",
                    page: true,
                    cols: cols,
                    skin: 'line',
                    toolbar: '#user-toolbar',
                    defaultToolbar: [{
                        title: '刷新',
                        layEvent: 'refresh',
                        icon: 'layui-icon-refresh',
                    }, 'filter',  'exports']
                });
                form.on('switch(user-status-set)', function (obj) {
                    console.log(obj);
                    var id= this.value;
                    var status= obj.elem.checked ? 0 :1 ;
                    var str= !status ? "已开启，可正常登录" : "已冻结，不可登录";
                    postData("{:url('admin/setUserStatus')}",{ id,status }).then(function(res){
                        if(res.code!=200){
                            layer.alert(res.message,{title:"提示"});
                            return;
                        }
                        layer.tips(str, obj.othis);
                    });

                });
                table.on('tool(user-table)', function (obj) {
                    if (obj.event === 'edit') {
                 
                        window.edit(obj.data);
                    }
                    if (obj.event === 'delete') {

                        window.delete(obj);
                    }
                });
                table.on('toolbar(user-table)', function (obj) {
                    if (obj.event === 'add') {

                        window.add();
                    }else if (obj.event === 'refresh') {
						window.refresh();
					}
                });
                window.refresh = function(param) {
					table.reload('tableId');
				}
                form.on('submit(form-save)', function (data) {
                    var data = $("#formId");
                    postDatai("{:url('basic/doBaiduj')}", data).then(function (res) {
                        if (res.code == 200) {
                            layer.msg(res.message, {
                                icon: 1,
                                time: 1000
                            }, function () {
                            	table.reload('tableId');
                               
                            });
                        } else {
                            layer.msg(res.message, {
                                icon: 2,
                                time: 1000
                            });
                        }
                    });
                    return false;
            });
            
            
   

                form.on('submit(user-query)', function (data) {
                    table.reload('tableId', {
                        page: {curr: 1 },
                        where: data.field
                    })
                    return false;
                });

			})
        </script>
{include file="base/footer"}